﻿using System;
using Castle.Core.Logging;
using DreamDriven.ObjectModel;
using DreamDriven.TestFramework;
using NUnit.Framework;
using ObjectModelTests.Stubs;
using Rhino.Mocks;

namespace ObjectModelTests
{
    [TestFixture]
    public class BaseBusinessLogicManagerTests
    {
        protected readonly MockRepository MockRepository = new MockRepository();
        private IDomainModel _domainModel;

        [SetUp]
        public void Initialize()
        {
            _domainModel = MockRepository.DynamicMock<IDomainModel>();
            ILogger logger = MockRepository.DynamicMock<ILogger>();
            _domainModel.Stub(dm => dm.Logger).Return(logger);
        }

        [Test]
        public void ConstructorNotNullDomainModelTest()
        {
            MockRepository.DynamicMock<BaseBusinessLogicManager>(_domainModel);
            MockRepository.ReplayAll();
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void ConstructorNullDomainModelTest()
        {
            new BusinessLogicManagerStub(null);
        }

        [Test]
        public void GetDomainModelValidationTest()
        {
            MockRepository.ReplayAll();
            var businessLogicManager = new BusinessLogicManagerStub(_domainModel);
            businessLogicManager.TestDomainModel(_domainModel);
        }      
    }
}
